home *** CD-ROM | disk | FTP | other *** search
- -- card: 50447 from stack: in
- -- bmap block id: 0
- -- flags: 0000
- -- background id: 4755
- -- name:
-
-
- -- part contents for background part 4
- ----- text -----
- SIMULATING 'ELSE IF'
-
- The 'else if' statement available in other languages is easily simulated using nested 'if' statements and the appropriate use of white space:
-
- if (i == 0)
- result = 'a';
- else if (i == 1 || i == 2)
- result = 'b';
- else if (i == 3)
- result = 'c';
- else
- result = 'd';
-
- An alternative which is often appropriate is the 'switch' statement discussed in the next section.
-
- -- part contents for background part 7
- ----- text -----
- 158